from typing import Optional
from pydantic import BaseModel
from uuid import UUID
from datetime import datetime


class ActivityBase(BaseModel):
    name: str
    activity_type_id: UUID
    time_start: Optional[datetime] = None
    time_end: Optional[datetime] = None
    location_admin: str
    location_detail: Optional[str] = None
    latitude: Optional[float] = None
    longitude: Optional[float] = None
    description: str
    organizer: Optional[str] = None
    contact_name: Optional[str] = None
    contact_phone: Optional[str] = None
    approver_name: Optional[str] = None
    approved_at: Optional[datetime] = None
    approval_result: Optional[str] = None
    status: Optional[str] = 'draft'
    indicator_version_id: Optional[UUID] = None


class ActivityCreate(ActivityBase):
    pass


class ActivityUpdate(ActivityBase):
    pass


class ActivityRead(ActivityBase):
    id: UUID

    class Config:
        from_attributes = True
